var array = [1,'1', '1', 1, 2, 1]

function unique(arr) {
    let res = []
    for (var i = 0; i < arr.length; i++) {
        var current = arr[i]
        if (res.indexOf(current) === -1) {
            res.push(current)
        }
    }
return res
}
console.log(unique(array));